1. Field of the Invention
The present invention relates to a method of and apparatus for interpolating gradation levels of an image for digital image data processing.
2. Description of the Background Art
Digital image data subjected to various types of image processing are sometimes lacking in gradation levels. For example, the lack of gradation levels occurs when gradation correction using a tone curve and contrast correction using a histogram are made to digital image data.
FIGS. 23A, 23B, and 23C illustrate the gradation correction using a tone curve. It is assumed that the gradation levels of all pixels included in inputted digital image data are determined to produce a histogram shown in FIG. 23A which illustrates the number of pixels versus gradation levels. Gradation correction is made based on a tone curve tc as shown in FIG. 23B to increase the brightness of the full image for processing of the image. If the gradation levels are supposed to be rounded down to the whole numbers, the gradation correction corrects gradation levels xe2x80x9c1xe2x80x9d, xe2x80x9c2xe2x80x9d, xe2x80x9c3xe2x80x9d, xe2x80x9c4xe2x80x9d, xe2x80x9c5xe2x80x9d to gradation levels xe2x80x9c2xe2x80x9d, xe2x80x9c4xe2x80x9d, xe2x80x9c5xe2x80x9d, xe2x80x9c6xe2x80x9d, xe2x80x9c6xe2x80x9d, respectively, whereas gradation levels xe2x80x9c0xe2x80x9d, xe2x80x9c6xe2x80x9d, xe2x80x9c7xe2x80x9d remain unchanged. FIG. 23C illustrates a histogram showing the number of pixels versus gradation levels after gradation interpolation using the tone curve tc. The histogram of FIG. 23C reveals that the number of pixels having the gradation levels xe2x80x9c1xe2x80x9d and xe2x80x9c3xe2x80x9d is zero, resulting in the lack of gradation levels.
FIGS. 24A and 24B illustrate the contrast correction using a histogram. It is assumed that an input image has a 256-step gradation ranging from a gradation level xe2x80x9c0xe2x80x9d to a gradation level xe2x80x9c255xe2x80x9d and the resultant histogram for the image is shown in FIG. 24A. Such an image generally contains a large number of pixels having an intermediate gradation and, accordingly, exhibits a low contrast. Thus, the contrast correction is made to enlarge an intermediate gradation level area H shown in FIG. 24A to full scale of gradation levels. The histogram for the image after the contrast correction is shown in FIG. 24B. The histogram of FIG. 24B shows that this contrast correction also presents the lack of gradation levels.
The lack of gradation levels also occurs in other cases where the length of data indicative of the gradation levels is increased, for example, converted from 8 bits to 16 bits and where 256-color image data is displayed in full color.
The above described lack of gradation levels produces pseudo outlines in the image that is not visually satisfactory.
To overcome the above described drawback, attempts have been made to perform smoothing processing on an image using a smoothing filter or to add noise to the image, thereby making the pseudo outlines inconspicuous.
However, the smoothing processing and the noise addition processing are carried out equally on the full image in the background art methods. This causes such processing to be performed on pixels which are not to be subjected to the processing to change the gradation levels of these pixels, resulting in degradation of the quality of the image.
For example, originally sharp outlines (edges) of an image having a significant difference in gradation level are also smoothed and lose their sharpness when subjected to the smoothing processing. The addition of noise to an image roughens an originally smooth part of the image.
The present invention is intended for a method of interpolating gradation levels of an original image. According to the present invention, the method comprises the steps of: (a) serially selecting an objective pixel from the original image; and (b) interpolating original gradation levels of neighboring pixels which are present in the neighborhood of the objective pixel, to determine a corrected gradation level of the objective pixel within a limited correction range, wherein the limited correction range is defined by limit values which are nearest to the original gradation level of the objective pixel among original gradation levels existing in a gradation distribution of the original image. This prevents the reversal and omission of gradation levels to achieve the gradation level interpolation without degradation of the quality of the image.
Preferably, in the above described method, the step (a) comprises the steps of: (a-1) obtaining the gradation distribution of the original image; (a-2) detecting existent pixels having original gradation levels which exist in the original image and whose adjacent gradation levels in the gradation distribution do not exist in the original image; and (a-3) serially selecting the objective pixel among the existent pixels. This provides the suitable interpolation of the gradation levels without the degradation of the quality of the image.
Preferably, in the above described method, the step (a) comprises the step of: (a-1) serially selecting the objective pixel among at least part of the original image, and the step (b) comprises the step of: (b-1) interpolating the original gradation levels of the neighboring pixels to increase gradation density of the original image while limiting a change in gradation level of the objective pixel to a unit interval of the original gradation levels. The gradation level interpolation gives rise to no reversal of the gradation levels.
Further, a plurality of reference pixels spatially adjacent to the objective pixel are selected, with the pixels having the same gradation level as the objective pixel ignored, and the spatial interpolation is performed on the gradation levels of the plurality of reference pixels. This prevents changes in the gradation levels of pixels which are not to be processed to cause no degradation of the quality of the image. The plurality of reference pixels are extracted by searching the image from the objective pixel in predetermined positive and negative directions. This improves the efficiency of the gradation level interpolation.
The interpolation according to the present invention is performed by scanning the image. The predetermined searching directions are determined in accordance with the scanning direction. This improves the processing efficiency.
Additionally, according to the present invention, a series of pixels are specified which are in spatially successive relation to the objective pixel and have the same gradation level as the objective pixel. The image is preliminarily searched from each of the series of pixels in the predetermined positive and negative directions for a plurality of tentative reference pixels. The plurality of reference pixels for the objective pixel are selected among respective sets of tentative reference pixels obtained for the series of pixels. This improves the accuracy of the gradation level interpolation.
Then, objective pixels are serially extracted from the image. Each of the objective pixels are subjected to the spatial interpolation so that the interpolated gradation level of the objective pixel equals one of the original gradation level of the objective pixel and the original gradation levels lacking in a gradation distribution for the image. Therefore, the gradation level interpolation gives rise to no reversal of the gradation levels.
Furthermore, according to the present invention, a spatial filter having a variable smoothing distance constant is defined. Sections of the image are scanned and smoothed using the spatial filter while the smoothing distance constant is changed in accordance with the spatial change rate of gradation levels in the respective image sections. This allows sufficient smoothing of a section with gentle gradation changes, and smoothing of an edge section without losing its sharpness.
It is therefore an object of the present invention to provide a method of and apparatus for interpolating gradation levels of an image without degradation of the quality of the image.
These and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings.